package com.cloudbroker.bcs.platform.dav.middle.bizservice.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.StringUtil;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.constants.HSBCPSErrorCodes.CommonErr;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.customer.back.LoginFormBackForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.common.sms.SmsBizService;
import com.cloudbroker.bcs.platform.dav.bizapi.service.common.sms.vo.SmsVerifyForm;
import com.cloudbroker.bcs.platform.dav.middle.service.ValidateCodeService;

@Service
public class SmsBizServiceImpl implements SmsBizService{

    @Resource
    private ValidateCodeService validateCodeService;
	
	@Override
	public HSBCPSBackVO funcCheckVerifyCode(SmsVerifyForm form) {
        String verify_code = form.getVerify_code();
        if (!StringUtil.isBlank(verify_code)) {
            if (!validateCodeService.checkCode(verify_code, form.getMobile(), "", Integer.parseInt(form.getVerify_source()))) {
                return VOUtil.genErrorResult(CommonErr.VERIFY_CODE_WRONG, LoginFormBackForm.class);
            }
        }
		return VOUtil.genSuccessBackVo();
	}

}
